CKEditor + Fancybox = 失败?
如果脚本仅在 Fancybox 打开的页面上加载,则 CKEditor + Fancybox 似乎可以工作。但是,如果父页面已初始化 CKEditor,则任何 Fancybox 打开的带有 CKEditor 的页面将不会立即工作。
每个实例都有一个唯一的 ID。
编辑器出现,但内容是空白的,无法点击进入。单击 SOURCE
和其他按钮通常会触发完整功能。
我尝试将 CKEDITOR.replaceAll();
添加到 Fancybox afterShow()
回调,但没有成功。
有人有幸这样做吗?
CKEditor + Fancybox seems to work IF the scripts are loaded ONLY on the page opened by Fancybox. If, however, the parent page has initialized CKEditor, any Fancybox opened pages with CKEditors on them will NOT immediately work.
Each instance has a unique ID.
The editor appears, but the content is blank, and can't be clicked into. Clicking SOURCE
and other buttons often triggers full functionality.
I've tried adding CKEDITOR.replaceAll();
to the Fancybox afterShow()
callback, no luck.
Anyone have any luck doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
老问题,但仅供参考,因为这个问题在两个模块的当前版本中仍然存在。
我发现解决这个问题的最佳方法是仅在短暂超时后在元素上创建 ckeditor。
因此,在此示例中,.html 页面有一个 id 为“ckeditor-textara”的文本区域。通过延迟一小部分,我可以让我的文本区域更可靠地渲染。 (代价只是 ckeditor 的可用性略有延迟)
Fancybox 与 ck 配合不佳;我认为是因为它复制了一堆与 DOM 混淆的 ajax 内容(尽管我没有花太多时间来验证其确切原因)。通过将 ckeditor 延迟到 onComplete 完成之后,事情会好得多。
Old question, but just for reference as this issue still persists in current versions of both modules..
The best way to get around this i find is to create the ckeditor on the element only after a small timeout.
So in this example the .html page has a text area with id of 'ckeditor-textara'. By delaying a fraction, i can get my text area to render way more reliably. (the trade off is just the slight delay in availability of the ckeditor)
Fancybox does not play nice with ck; i think because it does a bunch of copying of the ajax content which messes with the DOM (though i have not spent too much time verifying that as the exact cause). By delaying the ckeditor until after the onComplete has finished things work out a lot better.
基本上 DOM 事件被覆盖,所以你需要做的是在 afterLoad 上使用 setTimeout 来解决问题:
Basically the DOM events are being overwritten so what you need to do is use a setTimeout on the afterLoad to fix the problem:
post_body - 是您的文本区域 ID
post_body - is a your text area id